﻿@{
    ViewBag.Title = "TypeUpdate";
    Layout = "~/Views/Shared/_Layout.cshtml";
    Exam.Model.ContentType _ContentType = ViewData["ContentType"] as Exam.Model.ContentType;
}

<link href="~/Resources/Css/common.css" rel="stylesheet" />
<script src="~/resources/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
<link href="~/resources/bootstrapvalidator/css/bootstrapValidator.min.css" rel="stylesheet" />
<script src="~/Resources/jquery-confirm/js/jquery-confirm.js"></script>
<link href="~/Resources/jquery-confirm/css/jquery-confirm.css" rel="stylesheet" />
<form id="TypeAddForm">
    <div class="boxmain">
        <!-- box / title -->
        <div class="title">
            <ol class="breadcrumb">
                <li><a href="javascript:void(0);" onclick="goBack()">Test Item Content Type Management</a></li>
                <li class="active">Create Test Item Content Type</li>
            </ol>
        </div>
        <div class="form-horizontal">
            <div class="form-group">
                <label class="col-sm-2 control-label"><span>*</span>Modality</label>
                <div class="col-sm-10">
                    @{
                        IQueryable<Exam.Model.Modality> provincelist = ViewData["ModalityList"] as IQueryable<Exam.Model.Modality>;
                        List<SelectListItem> list = new List<SelectListItem>();
                        list.Add(new SelectListItem { Text = "Select Modality", Value = "", Selected = true });
                        foreach (Exam.Model.Modality item in provincelist)
                        {
                            if (item.ModalityID == _ContentType.ModalityID)
                            {
                                list.Add(new SelectListItem { Text = item.ModalityName, Value = item.ModalityID.ToString(), Selected = true });
                            }
                            else
                            {
                                list.Add(new SelectListItem { Text = item.ModalityName, Value = item.ModalityID.ToString() });
                            }
                        }
                    }
                    @Html.DropDownList("ModalitySelect", list, new { @class = "form-control" })
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span>*</span>Product</label>
                <div class="col-sm-10">
                    @{
                        IQueryable<Exam.Model.Product> productlist = ViewData["ProductList"] as IQueryable<Exam.Model.Product>;
                        List<SelectListItem> _productlist = new List<SelectListItem>();
                        _productlist.Add(new SelectListItem { Text = "Select Product", Value = "" });
                        foreach (Exam.Model.Product pitem in productlist)
                        {
                            if (pitem.ProductID != _ContentType.ProductID)
                            {
                                _productlist.Add(new SelectListItem { Text = pitem.ProductName, Value = pitem.ProductID.ToString() });
                            }
                            else
                            {
                                _productlist.Add(new SelectListItem { Text = pitem.ProductName, Value = pitem.ProductID.ToString(), Selected = true });
                            }
                        }

                    }
                    @Html.DropDownList("ProductSelect", _productlist, new { @class = "form-control" })
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span>*</span>Content Type</label>
                <div class="col-sm-10">
                    <input type="text" id="CType" name="CType" class="form-control" placeholder="Content Type" value="@_ContentType.TypeName" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">Is Active</label>
                <div class="col-sm-10">
                    @{
                        List<SelectListItem> activelist = new List<SelectListItem> {
                new SelectListItem { Text = "Active", Value = "0" },
                new SelectListItem { Text = "InActive", Value = "1" } };
                        activelist[(int)_ContentType.IsActive].Selected = true;
                    }
                    @Html.DropDownList("PIsActive", activelist, new { @class = "form-control" })
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <input type="submit" class="col-sm-1 btn btn-primary" value="Save" />
                    <div class=" col-sm-1"></div>
                    <input type="button" class="col-sm-1 btn btn-default" onclick="javascript: goBack();" value="Back" />
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="hidTypeID" value="@_ContentType.TypeID" />
    <input type="hidden" id="hidCreateTime" value="@_ContentType.CreateTime" />
    <input type="hidden" id="hidCreateUserID" value="@_ContentType.CreateUserID" />
</form>
<script src="~/Resources/Script/Product/ModalityGetProduct.js"></script>
<script src="~/Resources/Script/ContentType/TypeUpdate.js"></script>